package com.qf.day09.comparator;
import java.util.Comparator;
public class Comparato implements Comparator<Hero> {

    @Override
    public int compare(Hero o1, Hero o2) {
        int num1=o1.getName().length()-o2.getName().length();
        int num2=num1==0?o1.getHp()-o2.getHp():num1;
        int num3=num2==0?o1.getAd()-o2.getAd():num2;
        return num3;
    }
}
